?><?

function run_init_user(){
	
	global $nodatabase;
	global $users;
	global $user;

	$users	=get_entity("cls_user");

	if(!$users->is_login_try()&&$user=$users->hash_login()){
		$user=$users->login($user);
	}else{
		$user=$users->login();
	}

	if(!$user&&$nodatabse){
		die(erNoGuest);
	}else{
		if($nodatabase){
			$user=new cls_user_item();
			$user->login="admin";
			$user->password="admin";
			$user->admin=true;
		}
	}
	set_global($user,"user");
	$user->update_activity();
	return $user;
}
